module.exports = {
  pingDuoIfSellKdj () {
    const btbOpInfo = this.btbOpInfo
    const hourEma = this.btbItem.hourEmaInfo || {}
    const minute15EmaInfo = this.btbItem.minute15EmaInfo || {}
    const hourEma51020 = (hourEma.ema5 > hourEma.ema10 && hourEma.ema10 > hourEma.ema20)
    if (minute15EmaInfo.kdjDiff < 2) {
      if (btbOpInfo.actionStatus === 'sell-kdj') {
        if (
          (hourEma51020 && hourEma.kdjDiff > 0) &&
          (minute15EmaInfo.ema10 > minute15EmaInfo.ema20 && minute15EmaInfo.ema5 > minute15EmaInfo.ema10) &&
          minute15EmaInfo.tr > 0 && minute15EmaInfo.macd > 0
        ) {
          // 不平
        } else {
          this.pingDuo = true
          btbOpInfo.actionStatus = ''
          this.pingDuoReason = 'pingDuoIfSellKdj'
        }
      }
    } else {
      if (btbOpInfo.actionStatus === 'sell-kdj-done') {
        btbOpInfo.actionStatus = ''
      }
    }
  },
  pingDuoIfHourSellKdj () {
    const btbOpInfo = this.btbOpInfo
    const hourEma = this.btbItem.hourEmaInfo || {}
    const minute15EmaInfo = this.btbItem.minute15EmaInfo || {}
    if (btbOpInfo.hourSellKdj === 'sell-kdj') {
      if (
        hourEma.kdjDiff < 0 &&
        (minute15EmaInfo.ema10 < minute15EmaInfo.ema20 && minute15EmaInfo.ema5 < minute15EmaInfo.ema10) &&
        minute15EmaInfo.macd < 0 &&
        minute15EmaInfo.kdjDiff < 0
      ) {
        this.pingDuo = true
        btbOpInfo.hourSellKdj = ''
        this.pingDuoReason = 'pingDuoIfHourSellKdj'
      }
    }
  },
  pingDuoIfStopLoss () {
    const minute15EmaInfo = this.btbItem.minute15EmaInfo || {}
    const hourEmaInfo = this.btbItem.hourEmaInfo || {}
    // 大于3
    if (this.btbItem.incomeRate < -3) {
      if (minute15EmaInfo.kdjDiff < 0 && hourEmaInfo.kdjDiff < 0) {
        if (
          !(minute15EmaInfo.ema10 > minute15EmaInfo.ema20 && minute15EmaInfo.ema5 > minute15EmaInfo.ema10) ||
          minute15EmaInfo.macd < 0
        ) {
          this.setPingDuo('pingDuoIfStopLoss-1')
        }
      }
    }
  },
  pingDuoIfTargetProfit () {
    const minute15EmaInfo = this.btbItem.minute15EmaInfo || {}
    if (this.duoProfitHigh) {
      if (minute15EmaInfo.kdjDiff < 0 && minute15EmaInfo.macd < 0) {
        this.setPingDuo('pingDuoIfTargetProfit-1')
      }
    }
  }
}
